//
//  CPYSONGSModel.m
//  TTMusic
//
//  Created by chenpengyu on 16/4/9.
//  Copyright © 2016年 cpy. All rights reserved.
//

#import "CPYSONGSModel.h"

@implementation CPYSONGSModel


- (instancetype)initWithDataSource:(NSDictionary *)dataSource {
    self = [super init];
    if (self) {
        [self setValuesForKeysWithDictionary:dataSource];
        NSMutableArray *array = [NSMutableArray array];
        for (NSDictionary *dic in self.songs) {
            CPYDiscoveryPageSongListModel *songsModel = [[CPYDiscoveryPageSongListModel alloc] initWithDataSource:dic];
            [array addObject:songsModel];
        }
        self.songs = [NSMutableArray arrayWithArray:array];
    }
    return self;
}
- (void)setValue:(id)value forUndefinedKey:(NSString *)key {
    if ([key isEqualToString:@"image"]) {
        self.image = [[CPYRankListSongListImageModel alloc] initWithDataSource:value];
    }
    if ([key isEqualToString:@"data"]) {
        self.songs = value;
    }
    if ([key isEqualToString:@"songList"]) {
        self.songs = value;
    }

}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
